class Solution {
public:
    int diagonalSum(vector<vector<int>>& mat) {
         int sum=0;
         int i,j;
         int n=mat.size();
         
         for(i=0;i<n;i++){
             sum=sum+mat[i][i]+mat[i][n-1-i];
         }
         if (n%2==1) sum=sum-mat[n/2][n/2];
         return sum;
         }
         
    
};
